import { BasicFetchResult } from '../model/baseModel';
import { ProductItem } from './model';
import { defHttp } from '/@/utils/http/axios';

enum Api {
  List = '/company/admin/productDetail/listPage',
  Add = '/company/admin/productDetail/add',
  Delete = '/company/admin/productDetail/delete',
  Update = '/company/admin/productDetail/update',
  Info = '/company/admin/productDetail/detailById',
}

export const getList = (params: ProductItem) =>
  defHttp.post<BasicFetchResult<ProductItem>>({ url: Api.List, params });

export const addApi = (params: ProductItem) => defHttp.post<ProductItem>({ url: Api.Add, params });

export const updateApi = (params: ProductItem) =>
  defHttp.post<ProductItem>({ url: Api.Update, params });

export const deleteApi = (params: { id: string; zhCn: any }) =>
  defHttp.get<any>({ url: Api.Delete, params });

export const getInfoApi = (params: { id: string; zhCn: any }) =>
  defHttp.get<any>({ url: Api.Info, params });
